Skip to content

feat(slack)!: typed errors for every documented error code, plus object schemas - #1358

Draft
sam-goodwin wants to merge 6 commits into
mainfrom
feat/slack-typed-errors
Draft

sam-goodwin wants to merge 6 commits into
mainfrom
feat/slack-typed-errors

Conversation

@sam-goodwin

Copy link
Copy Markdown
Member

Every Slack method page documents the error codes it can return. The converter now turns each one into a typed error on the operations that list it, matched on the envelope's /error member:

yield* Conversations.createConversation({ name }).pipe(
  Effect.catchTag("NameTaken", () => findByName(name)),
);

*_not_found codes carry NotFoundError and already_* / *_taken codes carry AlreadyExistsError. Credential, throttling and server codes keep their shared classes (Unauthorized, SlackRateLimited, InternalServerError). Codes a page doesn't document still arrive as SlackError.

Patches:

  • conversations, usergroups, bookmarks, users: the docs reference the conversation, usergroup, bookmark and user objects by name with no JSON twin, so every response carrying them decoded as unknown. They are modelled from the documented objects.
  • canvases, conversations: document_content and canvas edit changes are modelled from the method examples.
  • tooling, apps: the rotated config token, the new app's verification_token, and app_token are marked sensitive like the secrets beside them.

The new error types widen operation signatures, hence the !.

The errors and schemas come from Slack's docs, not live responses. The companion alchemy PR (@alchemy.run/slack) has live tests for all of these, waiting on a test workspace.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Benchmarks: PR 5d49480c5 vs main 294d116ba

  • ⚪ Bundle size 54.7 KB: ±0.0% (±0 B), same as main
  • ⚪ Runtime speed 2.5 µs: −4.6% (−0.1 µs), same as main
  • ⚪ Runtime memory 795.4 KB: +3.2% (+24.8 KB), same as main
  • ⚪ Objects at import 1,059: +0.3% (+3), same as main
  • ⚪ Whole-SDK memory aws 39.7 MB (unchanged), cloudflare 8.27 MB (unchanged), gcp 24.8 MB (unchanged)
  • 🔴 Repo size 544.8 MB tracked in 9,904 files: +854.4 KB (+0.2%) vs main. .generated-specs/ 0 B, src/services/ 512.8 MB (+823.4 KB), everything else 32.0 MB.

sdk-memory

bundle-programs

memory-programs

bundle memory
speed objects

Numbers
Metric Change vs main Programs
Bundle (gzip) 1 worse 18
Import heap 1 worse 7
Objects at import no change 7
Added latency (p50) ¹ no change 7
Import time ¹ no change 7
First call ¹ no change 7
Program Call Bundle (gzip) Import heap Objects at import Added latency (p50) Import time First call
aws s3.listBuckets 79.4 KB — — — — —
aws~awsJson1_0 dynamodb.listTables 71.7 KB — — — — —
aws~awsJson1_1 kms.listKeys 70.9 KB — — — — —
aws~awsQuery sts.getCallerIdentity 72.3 KB — — — — —
aws~ec2Query ec2.describeRegions 72.4 KB — — — — —
aws~restJson1 lambda.listFunctions 73.1 KB — — — — —
azure resources.ListTenants 57.0 KB — — — — —
cloudflare workers.listScripts 69.3 KB — — — — —
cloudflare~CloudflareProtocol ips.listIps 49.9 KB — — — — —
fly-io machines.getRegions 50.9 KB 776.7 KB 1,088 3.4 µs 8.1 ms 3.3 ms
fly-io~FlyApiProtocol mpg.listUsers 50.6 KB 668.0 KB 982 2.1 µs 7.2 ms 3.0 ms
fly-io~SpritesProtocol sprites.createOrganizationToken 51.3 KB 706.2 KB 1,024 5.3 µs 7.6 ms 3.3 ms
gcp storage_v1.listBuckets 51.8 KB — — — — —
github gists.list 53.4 KB 656.6 KB 954 2.5 µs 6.8 ms 3.2 ms
neon neon.listProjects 52.1 KB 837.8 KB 1,084 1.5 µs 7.8 ms 3.1 ms
resend resend.listLogs 51.9 KB 868.4 KB 1,144 1.8 µs 7.9 ms 3.0 ms
slack admin.listEmoji 50.0 KB (+0.3%) 🔴 1.0 MB (+40.7%) 🔴 1,059 3.7 µs 7.7 ms 2.9 ms
stripe stripe.GetFiles 50.1 KB — — — — —

PR 5d49480c5 against main 294d116ba (main's cached run from 2026-11-21 04:12 UTC). 18 programs, measured in 25 s on 8 vCPU.

Package Tarball Unpacked Files
core 331.2 KB 1.3 MB 229
fly-io 250.2 KB 1.6 MB 71
github 2.1 MB 19.6 MB 338
neon 221.4 KB 1.2 MB 47
resend 173.2 KB 1.2 MB 57
slack 665.8 KB (+79.1%) 4.6 MB (+82.5%) 255
Tracked files Size Change vs main Files
services 512.8 MB +823.4 KB 3,024
in-tree-specs 98.3 KB ±0 B 4
patches 10.1 MB +25.6 KB 4,197
handwritten 9.6 MB +5.4 KB 1,957
benches 9.6 MB ±0 B 207
other 2.6 MB ±0 B 515
Total 544.8 MB +854.4 KB 9,904

What a checkout or worktree writes to disk, from git ls-tree (benches/repo-size/tree.ts). The dashboard's Repo size page has the full picture.

Effect alone: effect-minimal bundle 8.9 KB gzip, hand-written effect-http call 48.6 KB gzip; effect import 63.1 ms and 12.8 MB heap; bare mocked HTTP roundtrip 9.6 µs p50.

Bundled (from src/): resend, neon, github, fly-io, aws, cloudflare, gcp, azure, stripe, slack. Built and probed (from lib/): resend, neon, github, fly-io, slack. Changed in this PR: slack.

Job time: bundle 6.7 s, build: tsrs 0.2 s, build: bundle-lib 2.4 s, build: strip-lib-docs 0.1 s, build 2.7 s, size 0.9 s, runtime 14.6 s, providers 0.0 s.

¹ Timings run on a different runner than main's, so 🟡 marks a large move that may still be noise. Sizes, heap and object counts are stable. Offline: every call hits a canned in-memory response. Full suite: node benches/sdks/run.ts. Job log

@alchemy-version-bot

alchemy-version-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

@distilled.cloud (2)
pnpm install https://pkg.distilled.cloud/@distilled.cloud/core/pr:1358:5d49480
pnpm install https://pkg.distilled.cloud/@distilled.cloud/slack/pr:1358:5d49480

Published Nov 21, 2026, 9:31 AM UTC. Expires Nov 28, 2026, 9:31 AM UTC, extended while this pull request is open.

github-actions Bot added a commit that referenced this pull request Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant